<template>
	<view>
		<view class="baibox">
			<view class="flexCenterSpaceBetween" @tap="jumppage('/pages/me/mine')">
				<view>关于我们</view>
				<u-icon color="#999999" size="24" name="arrow-right"></u-icon>
			</view>
		</view>
		<!-- 吸底工具栏 -->
		<view class="toolbar-height" :style="{ paddingBottom: safeAreaInsets?.bottom + 40 + 'px' }"></view>
		<view class="toolbar" :style="{ paddingBottom: safeAreaInsets?.bottom + 40 + 'px' }">
			<view class="button-grounp">
				<view @tap="handloginout" class="button payment-button">
					注销实名信息
				</view>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { loginout, membersinfo } from "@/utils/api";
	import { onLoad } from "@dcloudio/uni-app";
	import { ref, reactive } from "vue";
	const idvalue = ref()
	const state = reactive({
		// dictionary: "1", // 字典值,后台路由配置，1-99 开发自用，大于100为用户自配
		// typeCode: "news", // 类型是图片还是内容，pic以及news
		id: null, // 具体的相应字典,相应类型的某一条数据,需从列表接口自己检索                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
	})
	onLoad(() => {
		idvalue.value = JSON.parse(uni.getStorageSync("userinfo")).id
		// let allAgreement = JSON.parse(uni.getStorageSync('allAgreement'))
		// state.id = allAgreement.privacy
	})
	const handloginout = () => {
		console.log(idvalue.value)
		loginout({ id: idvalue.value }).then((res) => {
			uni.showToast({ icon: "success", title: "注销实名信息成功" });
			// uni.clearStorageSync();
			membersinfo().then((meinfo) => {
				if (meinfo) {
					uni.setStorageSync("userinfo", JSON.stringify(meinfo.data));
					uni.reLaunch({ url: "/pages/bar" });
				}
			});
		});

	};
	const jumppage = (url:string) => {
	  // uni.navigateTo({ url: url+'?id='+ state.id+'&title='+'奢收多隐私协议'});
	  let allAgreement = JSON.parse(uni.getStorageSync('allAgreement'))
	  uni.navigateTo({ url: url+'?id='+ allAgreement[1].value.id+'&title='+'奢收多隐私协议'});
	};
</script>
<style lang="scss" scoped>
	.baibox {
		background: #fff;
		margin: 24rpx;
		padding: 30rpx;
		font-size: 23rpx;
		color: #212121;
		line-height: 33rpx;
	}
</style>